<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title>按药品汇总详情</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
							
    <section class="content-header">
        <h1>按药品汇总详情</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">采购计划汇总</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
            	<div class="input">
            		<div class="textalign1">医疗机构编码：</div>
            		<div class="boxinput">
            			<input class="textinput" type="text" id="searchHospCode" placeholder="医疗机构编码" maxlength="18" />
            		</div>
            		<div class="textalign">医疗机构名称：</div>
            		<div class="boxinput">
            			<input class="textinput" type="text" id="searchHospName" placeholder="医疗机构名称" maxlength="127" />
            		</div>
            		<div class="textalign">医疗机构分类：</div>
            		<div class="boxinput">
            			<select class="textinput" name="searchHospClassify" id="searchHospClassify">
                        	<option value="" >请选择</option>
                        	<option value="1">县级及县级以上医疗机构</option>
                        	<option value="2">基层医疗机构</option>
                        	<option value="3">部队医疗机构</option>
                        	<option value="4">民营医疗机构</option>
                        </select>
            		</div>
            	</div>
            	<div class="input">
            		<div class="textalign1">所属地区：</div>
            		<div class="boxinput">
            			<table style="width:100%">
            				<tr>
            					<td style="width:33%">
            						 <select class="textinput"  id="area1" name="area1" disabled="disabled">
			                        	<option value="${area.areaId }">${area.areaName }</option>
			                         </select>
            					</td>
            					<td style="width:33%">
            						<select class="textinput" id="area2" name="area2"></select>
            					</td>
            					<td style="width:33%">
            					 	<select class="textinput" id="area3" name="area3"></select>
            					</td>
            				</tr>
            			</table>
            		</div>
            		<div class="textalign">
            			<button type="button"  class="btn btn-success btn-sm" onclick="search();" id="selectc">查询</button>
            		</div>
            	</div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
        <div class=" box box-warning bottongroup">
             <button type=button, onclick='history.go(-1)' class="btn btn-default btn-sm" >返&nbsp;回</button>
        </div>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
    
    //绑定回车
    $('#searchHospCode,#searchHospName,#searchHospClassify,#area1,#area2,#area3').bind('keydown', function(event) {
        if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
            $('#selectc').click();
        }
    }); 
		
    $("#searchHospCode").focus();//加载页面光标在第一个查询框内
    
       function search(page){
    		var searchHospCode = $("#searchHospCode").val();
    		var searchHospName = $("#searchHospName").val();
    		var searchHospClassify = $("#searchHospClassify").val();
    		var area2 = $.trim($("#area2").val());
    		var area3 = $.trim($("#area3").val());
    		$("#gridlist").jqGrid('setGridParam',{
    	        datatype:'json',
    	        postData:{"hospCode":searchHospCode,
    	        		  "hospName":searchHospName,
    	        		  "hospClassify":searchHospClassify,
    	        		  "area2":area2,
    	        		  "area3":area3},
    	        page : (page || 1)
    	    }).trigger("reloadGrid"); //重新载入  
    	}
        $(function () {
            $("#gridlist").jqGrid({
                url: "getPlanListByDrug.html",
                mtype: "post",
                datatype: "json",
                postData: {"projId" : "${projId}","drugId" : "${drugId}"},
                autowidth: true,
                height: 270,
                colNames: [
					'医疗机构编码', 
					'医疗机构名称',
					'所属地区',
					'医疗机构分类', 
					'医疗机构类型',
					'去年采购数量',
					'计划采购数量',
					'采购方式',
					'质量要求'
                ],
                colModel: [
                    { name: 'hospCode', width: 10, align:"center", sortable: false,
                    	formatter:function(cellvalue, options, row){
                   		 return "<a href=\"javascript:void(0)\" onclick=\"showHospInfo('"+row.hospCode+"')\">"+cellvalue+"</a>";
                   		}
                    },
                    { name: 'hospName', width: 20, align:"center", sortable: false },
                    { name: 'arFullName', width: 10, align:"center", sortable: false},
                    { name: 'hospClassifyName', width: 12, align:"center", sortable: false},
                    { name: 'hospType', width: 10, align:"center", sortable: false},
                    { name: 'lasyProAmt', width: 8, align:"center", sortable: false},
                    { name: 'planProAmt', width: 8, align:"center", sortable: false},
                    { name: 'proMethod', width: 8, align:"center", sortable: false},
                    { name: 'qualityRequires', width: 10, align:"center", sortable: false}
                ],
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                multiselect: false, 
                viewrecords: true,
                caption: "${projName} - ${drugName}/${formName}/${specName}/${factor}/${unit}/${materialName}/${compName} - 按药品汇总详情",
                jsonReader: {
                	
                },
                gridComplete:function(){
                    //序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                    //数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                }
            });
            
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            
            $("#area2").HNSelect({
            	parent_selector: "#area1",  url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID",defaultText: "<option value=''>请选择</option>",
                func: function () {
                    $("#area3").HNSelect({
                        parent_selector: "#area2", url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID", defaultText: "<option value=''>请选择</option>",
                    });
                }
            });
            $(window).trigger("resize");
        })
    </script>
</body>
</html>



